home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / FAQs / netfaqs / X.speedups-faq < prev    next >
Text File  |  1994-08-01  |  33KB  |  757 lines

  1.  
  2. Newsgroups: comp.windows.x,news.answers,comp.answers
  3. From: art@cs.ualberta.ca (Art Mulder)
  4. Subject: comp.windows.x: Getting more performance out of X.  FAQ
  5. Followup-To: poster
  6. Date: 15 Apr 1994 14:39:48 GMT
  7. Organization: Computing Science, U of Alberta, Edmonton, Canada
  8. Lines: 741
  9. Approved: news-answers-request@MIT.Edu
  10. Expires: 20 May 94 23:00:00 GMT
  11. Reply-To: art@cs.ualberta.ca (Art Mulder)
  12. Summary: This posting contains a list of suggestions about what you can do to get the best performance out of X on your workstation -- without buying more hardware.
  13. Keywords: FAQ speed X
  14. Xref: bloom-beacon.mit.edu comp.windows.x:23711 news.answers:18078 comp.answers:4917
  15.  
  16. Archive-name: x-faq/speedups
  17. Last-modified: 1994/03/10
  18.  
  19. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  20.     HOW TO MAXIMIZE THE PERFORMANCE OF X -- monthly posting
  21. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  22.         Compiled by Art Mulder (art@cs.ualberta.ca)
  23.  
  24.   More RAM, Faster CPU's, More disk space, Faster Ethernet....  These
  25.   are the standard responses you hear when you ask how to improve the
  26.   performance of your workstation.
  27.  
  28.   Well, more hardware isn't always an option, and I wonder if more
  29.   hardware is always even a necessity.
  30.  
  31.   This "FAQ" list is a collection of suggestions and ideas from different
  32.   people on the net on how you can the best possible performance from X
  33.   Windows on your workstation, WITHOUT PURCHASING MORE HARDWARE.
  34.  
  35.   Performance is a highly subjective issue.  The individual user must
  36.   balance `speed' versus `features' in order to come to a personal
  37.   decision.  Therefore this document can be be expected to contain many
  38.   subjective opinions in and amongst the objective facts.
  39.  
  40.   This document is specifically concerned with X.  There are of course
  41.   many other factors that can affect the performance of a workstation.
  42.   However, they are outside the scope of this document.
  43.  
  44.     [ People seriously interested in the whole area of system
  45.     performance, might want to look at the O'Reilly Nutshell Handbook
  46.     "System Performance Tuning" by Mike Loukides.  IMHO, it contains a
  47.     well-written, comprehensive treatment of system performance.  I
  48.     refer to it a lot.  I'm unaware of any other similar books.  --ed.]
  49.  
  50. -----------------
  51. Table of Contents
  52. -----------------
  53.   0. Introduction & Administrivia
  54.   1. Window Managers
  55.   2. The X Server
  56.        Which Server?
  57.        Locking the Server into RAM?
  58.        Starting your Server
  59.        Fonts
  60.        About the Resources File
  61.        Define Your Display Properly
  62.   3. Clients
  63.        A Better Clock for X
  64.        A Better Terminal Emulator for X
  65.        Other Client Comments
  66.        Tuning your client
  67.   4. Miscellaneous Suggestions
  68.        Pretty Pictures
  69.        A Quicker Mouse
  70.        Programming Thoughts
  71.        Say What!?
  72.   5. Other Sources of Information
  73.        The "Other X FAQ"
  74.        Books & etc.
  75.   6. Author & Notes
  76.   
  77. ! = changed since last issue.
  78. * = new since last issue.
  79.  
  80. -----------------------------
  81. Introduction & Administrivia
  82. -----------------------------
  83.  
  84.   This document is posted each month, on or around the 15th, to the
  85.   Usenet news groups comp.windows.x, news.answers, and comp.answers.
  86.   If you are reading a copy of this FAQ which is more than a few
  87.   months old (see the "Last-modified" date above) you should probably
  88.   locate the latest edition, since the information may be outdated.
  89.  
  90.   If you do not know how to get those newsgroups and/or your site does
  91.   not receive them and/or this article has already expired, you can
  92.   retrieve this FAQ from an archive site.
  93.  
  94.   There exist several usenet FAQ archive sites.  To find out more about
  95.   them and how to access them, please see the "Introduction to the
  96.   news.answers newsgroup" posting in news.answers.
  97.  
  98.   The main FAQ archive is at rtfm.mit.edu.  This document can be found
  99.   there in /pub/usenet/news.answers/x-faq/speedups.  If you do not have
  100.   access to anonymous ftp, you can retrieve it by sending a mail
  101.   message to mail-server@rtfm.mit.edu with the command "send
  102.   usenet/news.answers/x-faq/speedups" in the message body.
  103.  
  104. ---------------
  105. Window Managers
  106. ---------------
  107.  
  108.   There are a lot of window managers out there, with lots of different
  109.   features and abilities.  The choice of which to use is by necessity a
  110.   balancing act between performance and useful features.  At this
  111.   point, most respondents have agreed upon "twm" as the best candidate
  112.   for a speedy window manager. 
  113.  
  114.   A couple of generic tricks you can try to soup up your window manger,
  115.   is turning off unnecessary things like "zooming" and "opaque move".
  116.   Also, if you lay out your windows in a tiled manner, you reduce the
  117.   amount of cpu power spent in raising and lowering overlapping
  118.   windows.                           Joe English (joe@trystero.art.com)
  119.  
  120.   I've found that a good font for tiling is 7x13 (aka:
  121.   -misc-fixed-medium-r-normal--13-100-100-100-c-70-iso8859-1 ). It is
  122.   the biggest font I know of that I can use on my Sun (1152x900 screen)
  123.   and still get two 80 column terminal windows side-by-side on the
  124.   display with no overlap.  Other font suggestions will be accepted.
  125.  
  126. Suggestions for your consideration:
  127.  
  128.   Linux'ers and others might want a look at fvwm.  A light-weight
  129.   virtual wm, targeted at ``machines with too little memory, at laptops
  130.   on which mouse usage may be awkward, and at users who prefer the
  131.   appearance of the Motif window manager to twm ... all wm functions
  132.   can be performed w/out a mouse'' [from the README].
  133.                                    Zack Evans (zevans@nyx.cs.du.edu)
  134.  
  135.   While originally developed for Linux, fvwm will compile on a number
  136.   of different platforms.  The fvwm docs claim a memory consumption of
  137.   about 1/3 to 2/3 that of twm.
  138.  
  139.   Speaking personally, fvwm may consume less memory but I found that it
  140.   `feels' slower than twm.  (For example: grab a window - I use opaque
  141.   move - and drag it around the screen.  Twm has a very snappy
  142.   response, but with fvwm v1.05 the window was lagging way behind the
  143.   pointer.  This comparison was done on two identical Sun SLC's)
  144.   However, I will also grant that fvwm is a young piece of software
  145.   that is being rapidly updated & improved so these concerns may soon
  146.   be fixed.                                                      [ed]
  147.  
  148. ------------ 
  149. The X Server
  150. ------------
  151.  
  152. Which Server?
  153. - - - - - - -
  154.   Make sure that your server is a proper match for your hardware.
  155.   If you have a monochrome monitor, use a monochrome X11 server.
  156.  
  157.   On my Monochrome Sun, I haven't noticed much difference between
  158.   the Xsun (colour) server and XsunMono, however it was pointed out to
  159.   me that XsunMono is about 800k smaller and therefore should contribute
  160.   to less paging.  
  161.          [ thanks to: Jonny Farringdon (j.farringdon@psychol.ucl.ac.uk),
  162.                         Michael Salmon (Michael.Salmon@eos.ericsson.se) ]
  163.  
  164.   How your server was compiled can also make a difference.  Jeff Law
  165.   (law@schirf.cs.utah.edu) advises us that on a Sun system, X should be
  166.   compiled with gcc (version 2.*) or with the unbundled Sun compiler.
  167.   You can expect to get "*very* large speedups in the server" by not
  168.   using the bundled SunOS compiler.  I assume that similar results
  169.   would occur if you used one of the other high-quality commercial
  170.   compilers on the market.
  171.  
  172. Locking the Server into RAM?
  173. - - - - - - - - - - - - - - -
  174.   It was suggested that perhaps hacking the X server so that it would
  175.   stay locked in RAM (and therefore not get paged out) might help
  176.   performances.  eg: via a call to plock().
  177.        [Eric C Claeys (ecc@eperm.att.com), Danny Backx (db@sunbim.be),
  178.     Juan D. Martin (juando@cnm.us.es)]
  179.  
  180.   Kenny Ranerup [kenny@axis.se] tried this a few years ago and
  181.   confirmed that it does work, and can give a noticeable speedup.  But,
  182.   you must be careful that your server doesn't grow too large (ie,
  183.   close to the size of your RAM).  He also makes the point that slow
  184. rformace is in many cases due to client paging (paging
  185.   in libraries), and not server paging.
  186.  
  187. Starting your Server
  188. - - - - - - - - - - -
  189.   Joe English (joe@trystero.art.com) :
  190.     If you start up a lot of clients in your .xsession or whatever, sleep
  191.     for a second or two after launching each one.  After I changed my
  192.     .xclients script to do this, logging in actually took *less* time...
  193.     we have a heavily loaded system without much core, though.
  194.  
  195.   This sounds crazy, but I have confirmed that it works!  
  196.  
  197.   Warner Losh (imp@Boulder.ParcPlace.COM) provided me with a good
  198.   explanation of why this works, which I have summarized here:
  199.  
  200.     When you start up an X server it takes a huge amount of time to
  201.     start accepting connections.  A lot of initialization is done by
  202.     the server when it starts.  This process touches a large number of
  203.     pages.  Any other process running at the same time would fight the
  204.     server for use of the CPU, and more importantly, memory.  If you
  205.     put a sleep in there, you give the Server a chance to get itself
  206.     sorted out before the clients start up.
  207.  
  208.     Similarly, there is also a lot of initialization whenever an X
  209.     client program starts: toolkits registering widgets, resources
  210.     being fetched, programs initializing state and "databases" and so
  211.     forth.  All this activity is typically memory intensive.  Once this
  212.     initialization is done ("The process has reached a steady state"),
  213.     the memory usage typically settles down to using only a few pages.
  214.     By using sleeps to stagger the launching of your clients in your
  215.     .Xinitrc , you avoid them fighting each other for your
  216.     workstation's limited resources
  217.  
  218.   This is most definitely a "Your Mileage May Vary" situation, as there
  219.   are so many variables to be considered: available RAM, local swap
  220.   space, load average, number of users on your system, which clients
  221.   you are starting, etc.
  222.  
  223.   Currently in my .xinitrc I have a situation like:
  224.     (sleep 1; exec xclock ) &
  225.     (sleep 1; exec xbiff ) &
  226.     (sleep 1; exec xterm ) &
  227.     (sleep 1; exec xterm ) &
  228.  
  229.   I've experimented with:
  230.     (sleep 1; exec xclock ) &
  231.     (sleep 2; exec xbiff ) &
  232.     (sleep 3; exec xterm ) &
  233.     (sleep 4; exec xterm ) &
  234.  
  235.   I've even tried:
  236.     (sleep 2; exec start_X_clients_script ) &
  237.   and then in start_X_clients_script I had:
  238.     (sleep 1; exec xclock ) &
  239.     (sleep 1; exec xbiff ) &
  240.     (sleep 1; exec xterm ) &
  241.     (sleep 1; exec xterm ) &
  242.  
  243.     [ The idea with this last one was to make sure that xinit had
  244.     completely finished processing my .xinitrc, and had settled down
  245.     into a "steady state" before the sleep expired and all my clients
  246.     were launched. ]
  247.  
  248.   All of these yielded fairly comparable results, and so I just stuck with
  249.   my current setup, for its simplicity.  You will probably have to
  250.   experiment a bit to find a setup which suits you.
  251.  
  252. Fonts
  253. - - -
  254.   Loading fonts takes time and RAM.  If you minimize the number of fonts
  255.   your applications use, you'll get speed increases in load-up time.
  256.  
  257.   One simple strategy is to choose a small number of fonts (one small, one
  258.   large, one roman, whatever suits you) and configure all your clients -- or
  259.   at least all your heavily used clients -- to use only those few fonts.
  260.   Client programs should start up quicker if their font is already loaded
  261.   into the server.  This will also conserve server resources, since fewer
  262.   fonts will be loaded by the server.
  263.                   [ Farrell McKay (fbm@ptcburp.ptcbu.oz.au),
  264.                     Joe English (joe@trystero.art.com) ]
  265.  
  266.   eg: My main xterm font is 7x13, so I also have twm set up to use 7x13
  267.   in all it's menus and icons etc.  Twm's default font is 8x13.  Since
  268.   I don't normally use 8x13, I've eliminated one font from my server.
  269.  
  270.   Oliver Jones (oj@roadrunner.pictel.com):
  271.     Keep fonts local to the workstation, rather than loading them over nfs.
  272.     If you will make extensive use of R5 scalable fonts, use a font server.
  273.  
  274. About the Resources File
  275. - - - - - - - - - - - - -
  276.  
  277.     Keep your .Xresources / .Xdefaults file small.  Saves RAM and saves
  278.     on server startup time.          Joe English (joe@trystero.art.com)
  279.  
  280.   One suggestion:
  281.  
  282.     In your .Xresources file, try putting only the minimum number of
  283.     resources that you want to have available to all of your
  284.     applications.  For example:  *reverseVideo: true
  285.  
  286.     Then, separate your resources into individual client-specific
  287.     resource files.  For example: $HOME/lib/app-defaults.  In your
  288.     .login file set the environment variable XUSERFILESEARCHPATH:
  289.  
  290.     setenv XUSERFILESEARCHPATH $HOME/lib/app-defaults/%N
  291.  
  292.     (Note:  It is easier and quicker for Xt to process
  293.     XUSERFILESEARCHPATH than XAPPLRESDIR.)
  294.  
  295.     [ The "comp.windows.x Frequently Asked Questions" FAQ contains
  296.     an excellent explanation of how this and the other main X
  297.     environment variables work.  --ed.]
  298.  
  299.     So, when xterm launches, it loads its resources from
  300.     .../app-defaults/XTerm.  Xdvi finds them in .../app-defaults/XDvi,
  301.     and so on and so forth.  Note that not all clients follow the same
  302.     XXxxx resource-file naming pattern.  You can check in your system
  303.     app-defaults directory (often: /usr/X11R5/lib/X11/app-defaults/) to
  304.     find the proper name, and then name your personal resource files
  305.     with the same name.
  306.  
  307.     This is all documented in the Xt Specification (pg 125 & 666).
  308.             [Thanks to: Kevin Samborn (samborn@mtkgc.com),
  309.                  Michael Urban (urban@cobra.jpl.nasa.gov),
  310.              Tom Bagli (tomb@gator.bocaraton.ibm.com),
  311.                      and Mike Long (mikel@ee.cornell.edu).
  312.          Kevin is willing mail his setup files to inquirers.]
  313.  
  314.   This method of organizing your personal resources has the following
  315.   benefits:
  316.  
  317.     - Easier to maintain / more usable.
  318.  
  319.     - Fewer resources are stored in the X server in the RESOURCE_MANAGER
  320.       property.  As a side benefit your server may start fractionally
  321.       quicker, since it doesn`t have to load all your resources.
  322.  
  323.     - Applications only process their own resources, never have to sort 
  324.       through all of your resources to find the ones that affect them.
  325.  
  326.   It also has drawbacks:
  327.  
  328.     - the application that you are interested in has to load an
  329.       additional file every time it starts up.  This doesn't seem to
  330.       make that much of a performance difference, and you might
  331.       consider this a huge boon to usability.  If you are modifying an
  332.       application's resource database, you just need to re-run the
  333.       application without having to "xrdb" again.
  334.  
  335.     - xrdb will by default run your .Xresources file through cpp.  When
  336.       your resources are split out into multiple resource files and
  337.       then loaded by the individual client programs, they will not.
  338.       WATCH OUT FOR THIS!!
  339.  
  340.       I had C style comments in my .Xresources file, which cpp stripped
  341.       out.  When I switched to this method of distributed resource
  342.       files I spent several frustrating days trying to figure out why
  343.       my clients were not finding their resources.  Xt did *NOT*
  344.       provide any error message when it encountered the C style
  345.       comments in the resource files, it simply, silently, aborted
  346.       processing the resource file.
  347.  
  348.       The loss of preprocessing (which can be very handy, e.g. ``#ifdef
  349.       COLOR'' ...) is enough to cause some people to dismiss this
  350.       method of resource management.
  351.  
  352.     - You may also run into some clients which break the rules.  For
  353.       example, neither Emacs (18.58.3) nor Xvt (1.0) will find their
  354.       resources if they are anywhere other than in .Xresources.
  355.  
  356.     - when starting up a client on a machine that does not share files
  357.       with the machine where your resources are stored, your client
  358.       will not find its resources.  Loading all your resources into the
  359.       server will guarantee that all of your clients will always find
  360.       their resources.            Casey Leedom (casey@gauss.llnl.gov)
  361.  
  362.   A possible compromise that I have tried, is to put resources for all
  363.   my heavily used clients (eg: xterm) into my .Xresources file, and to
  364.   use the "separate resources files" method for clients that I seldom
  365.   use.
  366.  
  367. Define Your Display Properly
  368. - - - - - - -
  369.  
  370.   Client programs are often executed on the same machine as the server.  In
  371.   that situation, rather than setting your DISPLAY environment variable to 
  372.   "<hostname>:0.0", where <hostname> is the name of your workstation, you
  373.   should set your DISPLAY variable to "unix:0.0" or ":0.0".  By doing this
  374.   you access optimized routines that know that the server is on the same
  375.   machine and use a shared memory method of transferring requests.
  376.             [thanks to Patrick J Horgan (pjh70@ras.amdahl.com)]
  377.  
  378.   See the _DISPLAY NAMES_ section of the X(1) man page for further
  379.   explanation of how to properly set your display name.
  380.  
  381.   "I don't think it's stock MIT, but (at least) Data General and HP have
  382.   libraries that are smart enough to use local communication even when
  383.   the DISPLAY isn't set specially."
  384.                   Rob Sartin (88opensi!sartin@uunet.UU.NET)
  385.  
  386.   [Jody Goldberg (jody@algorithmics.com) sent me an Xlib patch to change
  387.   stock R5 to use local communication even if DISPLAY is not properly set.
  388.   I don't want to get in the business of distributing or trying to juggle
  389.   non-MIT patches and so have elected not to include it here.  Hopefully MIT
  390.   will apply this minor (~8 lines) patch themselves.  In the meantime, if
  391.   you want to try it yourself, email Jody.  --ed.]
  392.  
  393. -------
  394. Clients
  395. -------
  396.  
  397.   If you only have a few megabytes of Ram then you should think
  398.   carefully about the number of programs you are running.  Think also
  399.   about the _kind_ of programs you are running.  For example:  Is there
  400.   a smaller clock program than xclock?
  401.  
  402.   Unfortunately, I haven't really noticed that programs advertise how large
  403.   they are, so the onus is on us to do the research and spread the word.
  404.  
  405.   [ Suggestions on better alternatives to the some of the standard clients
  406.   (eg: Xclock, Xterm, Xbiff) are welcome.  --ed.]
  407.  
  408.   I've received some contradictory advice from people, on the subject
  409.   of X client programs.  Some advocate the use of programs that are
  410.   strictly Xlib based, since Xt, Xaw and other toolkits are rather
  411.   large.  Others warn us that other applications which you are using
  412.   may have already loaded up one or more of these shared libraries.  In
  413.   this case, using a non-Xt (for example) client program may actually
  414.   _increase_ the amount of RAM consumed.
  415.  
  416.   The upshot of all this seems to be: Don't mix toolkits.  That is, try
  417.   and use just Athena clients, or just Xview clients (or just Motif
  418.   clients, etc).  If you use more than one, then you're dragging in
  419.   more than one toolkit library.
  420.  
  421.   Know your environment, and think carefully about which client
  422.   programs would work best together in that environment.
  423.  
  424.           [Thanks to: Rob Sartin (88opensi!sartin@uunet.UU.NET),
  425.       Duncan Sinclair (sinclair@dcs.gla.ac.uk | sinclair@uk.ac.gla.dcs) ]
  426.  
  427. A Better Clock for X
  428. - - - - - - - - - - -
  429.  
  430. 1) xcuckoo
  431.    suggested by: Duncan Sinclair (sinclair@dcs.gla.ac.uk)
  432.    available: on export.lcs.mit.edu
  433.  
  434.    Xcuckoo displays a clock in the title bar of *another* program.
  435.    Saves screen real estate.
  436.  
  437. 2) mclock
  438.    suggested by: der Mouse (mouse@Lightning.McRCIM.McGill.EDU)
  439.    available: larry.mcrcim.mcgill.edu (132.206.1.1) in /X/mclock.shar
  440.  
  441.    Non Xt-based.  Extensively configurable.  it can be made to look
  442.    very much like MIT oclock, or mostly like xclock purely by changing
  443.    resources.
  444.  
  445.   Of course, the ultimate clock --- one that consumes no resources, and 
  446.   takes up no screen real estate --- is the one that hangs on your wall.
  447.   :-) 
  448.  
  449. A Better Terminal Emulator for X
  450. - - - - - - - - - - - - - - - - -
  451.  
  452.   From the README file distributed with xterm:
  453.  
  454.   +-----
  455.   |         Abandon All Hope, Ye Who Enter Here
  456.   |
  457.   | This is undoubtedly the most ugly program in the distribution.
  458.   | ...
  459.   +-----
  460.  
  461.   Ugly maybe, but at my site it's still the most used.  I suspect that
  462.   xterm is one of the most used clients at many, if not most sites.
  463.   Laziness?  Isn't there a better terminal emulator available?  See below.
  464.  
  465.   If you must use xterm, you can try reducing the number of saveLines
  466.   to reduce memory usage.  [ Oliver Jones (oj@roadrunner.pictel.com),
  467.            Jonny Farringdon (j.farringdon@psychol.ucl.ac.uk) ]
  468.  
  469. 1) Xvt
  470.    Suggested by: Richard Hesketh (rlh2@ukc.ac.uk)
  471.    Author: John D. Bovey (jdb@ukc.ac.uk)
  472.    Available: export.lcs.mit.edu in /contrib/xvt-1.0.tar.Z
  473.  
  474.    [From the README file] "Xvt is an X terminal-emulator that is
  475.    designed to be more or less compatible with xterm while using much
  476.    less swap space.  It is mainly intended for use at sites which use
  477.    large numbers of X terminals but may also be useful on single
  478.    workstations that are short of memory.  On a [SunOS 4.1.* Sparc], an
  479.    initially invoked xvt uses about 1/3 megabyte of swap while xterm
  480.    uses about 1.3 megabytes (obtained by running pstat rather than ps
  481.    which seems to give unreliable size figures on SPARCs).  The main
  482.    way that xvt achieves its small size is by avoiding the use of the X
  483.    toolkit."
  484.  
  485.    Since it is a partial 'clone' of xterm, you don't have to rename
  486.    your resources, as xvt pretends to be "XTerm".  In it's current
  487.    version, you cannot bind keys as you can in xterm.  I've heard that
  488.    there are versions of xvt with this feature, but I've not found any
  489.    yet.
  490.  
  491.    UPDATE (Oct 1993):  John Bovey tells me that a new version of xvt is
  492.    in the works that should have some of the most frequently missed
  493.    xterm features.
  494.  
  495.    There have been some conflicting opinions aired over xvt vs. xterm.
  496.    Different sites with different needs will likely have to do
  497.    their own evaluation.  Caveat Emptor, your mileage may vary.
  498.  
  499.    I have seen hard data from J.Bovey showing how xvt does in fact
  500.    require less swap space than xterm.  However, both of us would still
  501.    like to see any other benchmarks that people can provide comparing
  502.    the two.  (eg: How much RAM each occupies, relative speed of each.)
  503.  
  504. 2) rxvt
  505.    Suggested by: Zack Evans (zevans@nyx.cs.du.edu)
  506.    Author: Rob Nation (nation@rocket.sanders.lockheed.com)
  507.  
  508.    Apparently a stripped down Linux port of xvt, with some 
  509.    minor modifications. 
  510.  
  511. 3) mterm
  512.    Suggested by/Author: der Mouse (mouse@Lightning.McRCIM.McGill.EDU)
  513.    Available: larry.mcrcim.mcgill.edu (132.206.1.1) in
  514.      /X/mterm.src/mterm.ball-o-wax.
  515.  
  516.    "I also have my own terminal emulator.  Its major lack is
  517.    scrollback, but some people like it anyway."
  518.  
  519. Other Client Comments
  520. - - - - - - - - - - -
  521.   When using the xlock screen locking client, the "qix" mode is
  522.   much more lightweight than the default mode.  
  523.                  [Q. Alex Zhao (azhao@cc.gatech.edu)]
  524.  
  525.   I can confirm the previous report from personal experience  here.  In
  526.   a lab full of ~20 sun 3/80's all running the Xkernel software, the
  527.   subnet was getting regularly clobbered.  This was tracked down to
  528.   students running xlock.  Since these machines are all xterminals, the
  529.   actual xlock program runs remotely, and generates a scary amount of
  530.   network traffic to draw the default 'swarm' pictures on the screen.
  531.   We have removed this program and replaced it with a much simpler
  532.   screen locking program which simply blanks the screen.        [ed.]
  533.  
  534.   An improved xbiff: Xbuffy.  It can watch multiple mailboxes and can
  535.   do a pop up showing the From and Subject line of incoming mail.
  536.   Xbiff doesn't eat much memory and Xbuffy tends to be about the same
  537.   (on the RS/6000, xbuffy tends use just a little less memory).  It is
  538.   in the contrib directory on ftp.x.org.
  539.                                [ Bill Pemberton (wfp5p@virginia.edu) ]
  540.  
  541. Tuning your client
  542. - - - - - - - - - -
  543.  
  544.   Suggestions on how you can tune your client programs to work faster.
  545.  
  546.   From Scott Barman (scott@asd.com) comes a suggestion regarding Motif
  547.   Text Field Widgets:
  548.  
  549.     I noticed that during data entry into Motif text field widgets, I
  550.     was getting a slight lag in response to some keystrokes,
  551.     particularly the initial one in the field.  Examining the what was
  552.     going on with xscope I found it.  It seems that when the resource
  553.     XmNblinkRate is non-zero and the focus is on a text field widget
  554.     (or even just a text widget) the I-beam cursor will blink.
  555. , the
  556.     widget code is making a request to the server (CopyArea).  The user
  557.     can stop this by setting the resource XmNblinkRate to 0.  It is not
  558.     noticeable on a 40MHz SPARC, but it does make a little difference
  559.     on a [slower system].
  560.  
  561.   This specific suggestion can probably be applied in general to lots
  562.   of areas.  Consider your heavily used clients, are there any minor
  563.   embellishments that can be turned off and thereby save on Server
  564.   requests?
  565.  
  566. -------------------------
  567. Miscellaneous Suggestions
  568. -------------------------
  569.  
  570. Pretty Pictures
  571. - - - - - - - -
  572.   Don't use large bitmaps (GIF's, etc) as root window backgrounds.
  573.  
  574.   - The more complicated your root window bitmap, the slower the server
  575.     is at redrawing your screen when you reposition windows (or redraw, etc)
  576.  
  577.   - These take up RAM, and CPU power.  I work on a Sun SPARC and I'm
  578.     conscious of performance issues, I can't comprehend it when I see
  579.     people with a 4mb Sun 3/60 running xphoon as their root window.
  580.  
  581.     I'll let someone else figure out how much RAM would be occupied by
  582.     having a full screen root image on a colour workstation.
  583.  
  584.   - If you're anything like me, you need all the screen real estate
  585.     that you can get for clients, and so rarely see the root window anyway.
  586.  
  587.               [ Thanks to Qiang Alex Zhao (azhao@cs.arizona.edu) 
  588.             for reminding me of this one. --ed.]
  589.  
  590. A Quicker Mouse
  591. - - - - - - - -
  592.   Using xset, you can adjust how fast your pointer moves on the screen
  593.   when you move your mouse.  I use "xset m 3 10" in my .xinitrc file,
  594.   which lets me send my pointer across the screen with just a flick of
  595.   the wrist.  See the xset man page for further ideas and information.
  596.  
  597.   Hint: sometimes you may want to *slow down* your mouse tracking for
  598.   fine work.  To cover my options, I have placed a number of different
  599.   mouse setting commands into a menu in my window manager.  
  600.  
  601.   e.g. (for twm) :
  602.       menu "mouse settings" {
  603.         "Mouse Settings:"            f.title
  604.     "  Very Fast"                ! "xset m 7 10 &"
  605.     "  Normal (Fast)"            ! "xset m 3 10 &"
  606.     "  System Default (Un-Accelerated)"    ! "xset m default &"
  607.     "  Glacial"                ! "xset m 0 10 &"
  608.       }
  609.  
  610. Programming Thoughts
  611. - - - - - - - - - - -
  612.   Joe English (joe@trystero.art.com) :
  613.     To speed up applications that you're developing, there are tons of
  614.     things you can do.  Some that stick out:
  615.  
  616.     - For Motif programs, don't set XmFontList resources for individual
  617.       buttons, labels, lists, et. al.; use the defaultFontList or
  618.       labelFontList or whatever resource of the highest-level manager
  619.       widget.  Again, stick to as few fonts as possible.
  620.  
  621.     - Better yet, don't use Motif at all.  It's an absolute pig.
  622.  
  623.     - Don't create and destroy widgets on the fly.  Try to reuse them.
  624.       (This will avoid many problems with buggy toolkits, too.)
  625.  
  626.     - Use a line width of 0 in GCs.  On some servers this makes a HUGE
  627.       difference.
  628.  
  629.     - Compress and collapse multiple Expose events.  This can make the
  630.       difference between a fast application and a completely unusable
  631.       one.
  632.  
  633.   Francois Staes (frans@kiwi.uia.ac.be) :
  634.     Just a small remark: I once heard that using a better malloc
  635.     function would greatly increase performance of Xt based
  636.     applications since they use malloc heavily. They suggested trying
  637.     out the GNUY malloc, but I didn't find the time yet. I did some
  638.     tests on small programs just doing malloc and free, and the
  639.     differences were indeed very noticeable ( somewhat 5 times faster)
  640.  
  641.   [ Any confirmation on this from anyone?  --ed.]
  642.  
  643.   Andre' Beck (Andre_Beck@IRS.Inf.TU-Dresden.de) :
  644.  
  645.   - Unnecessary NoExpose Events.
  646.  
  647.     Most people use XCopyArea/XCopyPlane as fastest blit routines, but
  648.     they forget to reset graphics_exposures in the GC used for the
  649.     blits. This will cause a NoExpose Event every blit, that, in most
  650.     cases, only puts load onto the connection and forces the client to
  651.     run through it's event-loop again and again.
  652.  
  653.   - Thousands of XChangeGC requests.
  654.  
  655.     This "Gfx Context Switching" is also seen in most handcoded X-Apps,
  656.     where only one or few GCs are created and then heavily changed
  657.     again and again.  Xt uses a definitely better mechanism, by caching
  658.     and sharing a lot of GCs with all needed parameters. This will
  659.     remove the load of subsequent XChangeGC requests from the
  660.     connection (by moving it toward the client startup phase).
  661.  
  662. Say What!?
  663. - - - - - - 
  664.   Some contributors proposed ideas that seem right off the wall at first:
  665.  
  666.   David B. Lewis (by day: dbl@osf.org, by night: david%craft@uunet.uu.net) :
  667.     How about this: swap displays with someone else. Run all your programs
  668.     on the other machine and display locally; the other user runs off your
  669.     machine onto the other display. Goal: reduce context switches in the
  670.     same operation between client and server.
  671.  
  672.   I'm not in a situation where I can easily try this, but I have received
  673.   the following confirmation...
  674.  
  675.   Michael Salmon (Michael.Salmon@eos.ericsson.se):
  676.     I regularly run programs on other machines and I notice a big
  677.     difference. I try to run on a machine where I will reduce net usage
  678.     and usually with nice to reduce the impact of my intrusion. This
  679.     helps a lot on my poor little SS1+ with only 16 MB, it was
  680.     essential when I only had 8 MB.
  681.  
  682.   Casey Leedom (casey@gauss.llnl.gov) :
  683.     [The X11 Server and the client are] competing for the same CPU as
  684.     your server when you run it on the same machine.  Not really a
  685.     major problem, except that the X11 client and the server are in
  686.     absolute synchronicity and are context thrashing.
  687.  
  688.   Timothy H Panton (thp@westhawk.uucp) :
  689.     Firstly it relies on the fact that most CPU's are mostly idle, X's
  690.     cpu usage is bursty.  so the chances of you and your teammate
  691.     doing something cpu-intensive at the same time is small. If they
  692.     are not then you get twice the cpu+memory available for your
  693.     action.
  694.  
  695.     The second factor is that context switches are expensive, using 2
  696.     cpu's halves them, you pay a price due to the overhead of going
  697.     over the network, but this is offset in most cases by the improved
  698.     buffering of a network (typically 20k vs 4k for a pipe), allowing
  699.     even fewer context switches.
  700.  
  701. ----------------------------
  702. Other Sources of Information
  703. ----------------------------
  704.  
  705. The "Other X FAQ"
  706. - - - - - - - - -
  707.  
  708.   David B. Lewis (faq%craft@uunet.uu.net) maintains the informative and
  709.   well written "comp.windows.x Frequently Asked Questions" document.
  710.   Its focus is on general X information, while this FAQ concentrates
  711.   on performance.
  712.  
  713.   The comp.windows.x FAQ does address the issue of speed, but only with
  714.   regards to the X server.  The gist of that topic seems to be:
  715.     "Use X11R5, it is faster than R4".
  716.   (Please see the X FAQ for complete details).
  717.  
  718. Books & etc.
  719. - - - - - - -
  720.  
  721.   Volume 8 in O'Reilly's X Window System Series; ``X Window System
  722.   Administrator's Guide'' is a book that all X administrator's should
  723.   read.
  724.  
  725.   Adrian Nye (adrian@ora.com):
  726.     A lot more tips on performance are in the paper "Improving X
  727.     Application Performance" by Chris D. Peterson and Sharon Chang, in
  728.     Issue 3 of The X Resource.
  729.  
  730.     An earlier version of this paper appeared in the Xhibition 1992
  731.     conference proceedings.
  732.  
  733.     This paper is absolutely essential reading for X programmers.
  734.  
  735. --------------
  736. Author & Notes
  737. --------------
  738.   This list is currently maintained by Art Mulder (art@cs.ualberta.ca)
  739.  
  740.   Suggestions, corrections, or submission for inclusion in this list
  741.   are gladly accepted.  Layout suggestions and comments (spelling
  742.   mistak's too! :-) are also welcome.
  743.  
  744.   Currently I have listed all contributors of the various comments and
  745.   suggestions.  If you do not want to be credited, please tell me.
  746.  
  747.   speedup-x-faq is copyright (c) 1993 by Arthur E. Mulder
  748.  
  749.   You may copy this document in whole or in part as long as you don't
  750.   try to make money off it, or pretend that you wrote it.
  751.  
  752. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  753. --
  754.  ...art mulder ( art@cs.ualberta.ca )    | "Do not be conformed to this world,
  755.  http:   |  but be transformed by the renewal
  756.  CS Dept, U of Alberta, Edmonton, Canada |  of your mind, ..."  Romans 12:2
  757.